/*
 * Camera.h
 *
 *  Created on: 22.11.2012
 *      Author: Michael
 */

#ifndef CAMERA_H_
#define CAMERA_H_

#include "stm32f4xx.h"
#include "stm32f4xx_dcmi.h"
#include "stm32f4xx_misc.h"
#include "../Threads/global.h"


#define CAPTUREMODE					DCMI_CaptureMode_SnapShot
#define FRAMERATE					DCMI_CaptureRate_All_Frame
//#define CAPTUREMODE				DCMI_CaptureMode_Continuous
//#define FRAMERATE					DCMI_CaptureRate_1of4_Frame

#define IMAGESIZE					(HEIGHT*WIDTH*2)
#define IMAGEBUFFERSIZE					(IMAGESIZE+12)

#ifdef QVGA
#define RES_WIDTH				320
#define RES_HEIGHT				240
#endif
#ifdef QQVGA
#define RES_WIDTH				160
#define RES_HEIGHT				120
#endif


#define DCMI_DR_ADDRESS      		0x50050028

class Camera {
public:
	Camera();
	virtual ~Camera();
	uint8_t* getPicture();
	void init_DCMI();
	void EnableDCMI();
	void Capture();
	void DisableDCMI();
	uint8_t DCMI_Buffer[IMAGEBUFFERSIZE];
private:
	void init_GPIO();
};

#endif /* CAMERA_H_ */
